<script setup lang="ts">
import AsideBar from '@/components/aside/index.vue'
import User from './user.vue'
import Warn from './warn.vue'
import Ready from './ready.vue'
import Plan from './plan.vue'
import Already from './already.vue'
import Modal from '@/components/modal/Modal.vue'
import { ref } from 'vue'

const isModalVisible = ref(false)
const currentModalType = ref('fxjh') // 默认值，可以根据需要调整

const openModal = (type: string) => {
  currentModalType.value = type
  isModalVisible.value = true
}

const closeModal = () => {
  isModalVisible.value = false
}


const modalData = ref([
  { key: '放飞计划编号', value: 'MXH-2087382091' },
  { key: '飞行计划名称', value: '梅溪湖美团物流专线' },
  { key: '飞行开始时间', value: '2025/6/17 12:00' },
  { key: '飞行结束时间', value: '2025/6/17 12:10' },
  { key: '空间图形', value: '-' },
  { key: '发布状态', value: '已发布' },
  { key: '飞行计划性质', value: '物流配送' },
  { key: '飞行任务类型', value: '短途运输' },
  { key: '起飞时间', value: '-' },
  { key: '飞行器编号', value: 'DJ-232-12' },
  { key: '飞行员信息', value: '长沙**公司' }
]) 
</script>

<template>
  <main class="content">
    <aside-bar mode="left">
      <!-- 实时飞行用户 -->
      <user />
      <div class="content-dash"></div>
      <!-- 实时告警 -->
      <warn />
    </aside-bar>
    <aside-bar mode="right">
      <!-- 计划 -->
      <plan />
      <div class="content-dash"></div>
     <!-- 待飞 -->
      <ready @open-modal="openModal" />
      <div class="content-dash"></div>
      <!-- 已飞 -->
      <already @open-modal="openModal" />
    </aside-bar>
    <!-- <button @click="openModal">打开弹窗</button> -->
    <Modal :isVisible="isModalVisible" :modalType="currentModalType" @close="closeModal">
      <div class="modal-content">
        <div class="img"></div>
        <div class="name">DJL Avata2</div>
      </div>
      <div class="modal-line"></div>
      <div class="modal-table">
        <div class="modal-table-row" v-for="(item, index) in modalData" :key="index">
          <div class="modal-table-item-key">{{ item.key }}</div>
          <div class="modal-table-item-value">{{ item.value }}</div>
        </div>
        <!-- <div class="modal-table-overlay"></div> -->
      </div>
    </Modal>
  </main>
</template>

<style lang="scss" scoped>
.content {
  position: relative;
  height: 100%;
  width: 100%;
  // 内容物
  z-index: 30;

  &-dash {
    width: 100px;
    height: 54px;
  }
}
.modal-content {
  display: flex;
  .img{
    width: 58px;
    height: 60px;
    background: url("@/assets/facility/modal/wrj.svg")  0% 0% / 100% 100% no-repeat;
    margin: 10px 10px 0px 38px;
  }
  .name{
    font-family: Source Han Sans CN;
    font-size: 20px;
    font-weight: bold;
    line-height: normal;
    letter-spacing: normal;
    color: #158AE4;
    line-height: 70px;
    margin-left: 10px;
  }
}
.modal-line{
  height: 1px;
  width: 380px;
  margin:0 auto;
  // border-top: 1px solid;
  background: linear-gradient(90deg, rgba(21, 152, 251, 0) 0%, rgba(21, 152, 251, 0.5626) 48%, rgba(21, 152, 251, 0) 111%) ;
}
.modal-table{
  margin-top: 10px;
  height: 210px; 
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE 10+ */
  &::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera*/
  }
  position: relative;
  .modal-table-row{
    display: flex;
    justify-content: center;
    color: #FFFFFF;
    font-family: Source Han Sans CN;
    font-size: 14px;
    font-weight: normal;
    line-height: 33px;
    letter-spacing: normal;
    .modal-table-item-key{
      width: 104px;
      height: 33px;
      box-sizing: border-box;
      border: 1px solid #158CE8;
    }
    .modal-table-item-value{
      width: 276px;
      height: 33px;
      box-sizing: border-box;
      border: 1px solid #158CE8;
    }
  }
  
}
</style>
